Add a type (with format output '1') to the '%' output.
authorrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Mon, 23 Feb 2004 04:25:54 +0000 (04:25 +0000)
committerrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Mon, 23 Feb 2004 04:25:54 +0000 (04:25 +0000)
38 files changed:
gpsbabel/cetus.c
gpsbabel/copilot.c
gpsbabel/csv_util.c
gpsbabel/csv_util.h
gpsbabel/defs.h
gpsbabel/delgpl.c
gpsbabel/easygps.c
gpsbabel/garmin.c
gpsbabel/gcdb.c
gpsbabel/geo.c
gpsbabel/geoniche.c
gpsbabel/gpilots.c
gpsbabel/gpsdrive.c
gpsbabel/gpspilot.c
gpsbabel/gpsutil.c
gpsbabel/gpx.c
gpsbabel/holux.c
gpsbabel/internal_styles.c
gpsbabel/magnav.c
gpsbabel/magproto.c
gpsbabel/mapopolis.c
gpsbabel/mapsend.c
gpsbabel/mapsource.c
gpsbabel/navicache.c
gpsbabel/nmea.c
gpsbabel/ozi.c
gpsbabel/pcx.c
gpsbabel/psitrex.c
gpsbabel/psp.c
gpsbabel/quovadis.c
gpsbabel/saroute.c
gpsbabel/style/custom.style
gpsbabel/style/tabsep.style
gpsbabel/tiger.c
gpsbabel/tmpro.c
gpsbabel/tpg.c
gpsbabel/vecs.c
gpsbabel/xcsv.c

index f8373521a8933c99b60e929f1ec4b0d240bee7bd..170dd8bf996033e9bb50935af05dcab1b2881a42 100644 (file)
@@ -415,6 +415,7 @@ data_write(void)
 
 
 ff_vecs_t cetus_vecs = {
+       ff_type_file,
        rd_init,
        wr_init,
        rd_deinit,
index 3ee51f824e710d33dd393e363f39e2b4e9f28013..44a55e0cb02df58a06535199ca84c27b79ad6370 100644 (file)
@@ -192,6 +192,7 @@ data_write(void)
 
 
 ff_vecs_t copilot_vecs = {
+       ff_type_file,
        rd_init,
        wr_init,
        rd_deinit,
index 85dd77ef280705d3b36af5297ad0699f2bf623ea..c095d7e514142667fe7ae154127225bcde7615ce 100644 (file)
@@ -329,6 +329,10 @@ xcsv_file_init(void)
      */
     xcsv_file.ofield = xcalloc(sizeof(queue), 1);
     QUEUE_INIT(xcsv_file.ofield);
+    /*
+     * Provide a sane default for CSV _files_.
+     */
+    xcsv_file.type = ff_type_file;
 
     xcsv_file.mkshort_handle = mkshort_new_handle();
 }
index 7338fa8bac9fe9ffe134337c5da86db40dbda0be..197b5884270ccab951a70470d3ececea08b5e8ba 100644 (file)
@@ -120,6 +120,7 @@ typedef struct {
     char * extension;          /* preferred filename extension (for wrappers)*/
     
     void * mkshort_handle;     /* handle for mkshort() */
+    ff_type type;              /* format type for GUI wrappers. */
     
 } xcsv_file_t;
 
index 807b2362c260796680db6ae93e61b88659bc647d..c78a7b56eb83f852488737fd9fef01384fcf6225 100644 (file)
@@ -301,7 +301,17 @@ typedef struct arglist {
        long argtype;
 } arglist_t;
 
+typedef enum {
+       ff_type_file = 1,       /* normal format: useful to a GUI. */
+       ff_type_internal,       /* fmt not useful with default options */
+       ff_type_serial,         /* format describes a serial protoco (GUI can display port names) */
+} ff_type;
+
+/*
+ *  Describe the file format to the caller.
+ */
 typedef struct ff_vecs {
+       ff_type type;
        ff_init rd_init;
        ff_init wr_init;
        ff_deinit rd_deinit;
index 7709e82592b1fff2c36f5fd31ce4021a603c2839..73e1c678480d97a393ff8f48c5103a4db2d2d461 100644 (file)
@@ -110,6 +110,7 @@ gpl_write(void)
 }
 
 ff_vecs_t gpl_vecs = {
+       ff_type_file,
        gpl_rd_init,    
        gpl_wr_init,    
        gpl_rd_deinit,  
index e028e052b4f12af00d9063861995d5eb2c2476f2..d568b26103956988e4ce5785a824a98480b8896c 100644 (file)
@@ -261,6 +261,7 @@ data_write(void)
 
 
 ff_vecs_t easygps_vecs = {
+       ff_type_file,
        rd_init,
        wr_init,
        rd_deinit,
index f23f7075f221da646cb12e2ac45a45c259293518..34babd697030e70d30a4ad8e711bf1d0ce0f6196 100644 (file)
@@ -560,6 +560,7 @@ data_write()
 
 
 ff_vecs_t garmin_vecs = {
+       ff_type_serial,
        rw_init,
        rw_init,
        rw_deinit,
index a439e0ee6053f742cf6a78147898fdd33d82e925..b4bd3ac52b29164daa40d1517f6327a92bbe2a52 100644 (file)
@@ -330,6 +330,7 @@ data_write(void)
 
 
 ff_vecs_t gcdb_vecs = {
+       ff_type_file,
        rd_init,
        wr_init,
        rd_deinit,
index ffb0812edc1003adc86926800fe53beb8e41da4b..1f4425cb0b2044f6ffcc68b6c2cc606d82a955f5 100644 (file)
@@ -286,6 +286,7 @@ geo_write(void)
 }
 
 ff_vecs_t geo_vecs = {
+       ff_type_file,
        geo_rd_init,    
        geo_wr_init,    
        geo_rd_deinit,
index 94cf48e8dc3b18edde8bb83dabeea886d2336c98..36f3901d2bd858fc171be4c157ca4728abb4386c 100644 (file)
@@ -524,6 +524,7 @@ data_write(void)
 
 ff_vecs_t geoniche_vecs =
 {
+       ff_type_file,
        rd_init,
        wr_init,
        rd_deinit,
index 3e4c87428bc4d2ee27042621c37f32aa6d964707..b615fde997c7339aa03019f648434151fa2df42c 100644 (file)
@@ -304,6 +304,7 @@ data_write(void)
 
 
 ff_vecs_t gpilots_vecs = {
+       ff_type_file,
        rd_init,
        wr_init,
        rd_deinit,
index b6dd6262d0c19149071579d2ea944446e88d1697..51bd73d15e8f626698bdd4abe035bf56c6bef9c5 100644 (file)
@@ -196,6 +196,7 @@ data_write(void)
 }
 
 ff_vecs_t gpsdrive_vecs = {
+       ff_type_file,
        rd_init,
        wr_init,
        rd_deinit,
index 8502cb189d9e1708560fb1b35daa216f9426a8e7..36f4ec0715f1515580ec88cb56d934415cb879fb 100644 (file)
@@ -246,6 +246,7 @@ data_write(void)
 
 
 ff_vecs_t gpspilot_vecs = {
+       ff_type_file,
        rd_init,
        wr_init,
        rd_deinit,
index 081a8435c1aaecb29cf487638994a593f06492cf..c8d5ae85aabcb35276db68b3f165ab0d6faf50d2 100644 (file)
@@ -121,6 +121,7 @@ data_write(void)
 
 
 ff_vecs_t gpsutil_vecs = {
+       ff_type_file,
        rd_init,
        wr_init,
        rd_deinit,
index eba8bf77522f8c029d6c5432594d4e71e5d016dc..5b137c4d021f349795b6d4566e56ef78e95a0041 100644 (file)
@@ -1214,6 +1214,7 @@ arglist_t gpx_args[] = {
 };
 
 ff_vecs_t gpx_vecs = {
+       ff_type_file,
        gpx_rd_init,    
        gpx_wr_init,    
        gpx_rd_deinit,  
index eb6e4baf2a830df690ecdbb73779c44c2f748937..41735b2d4c9fc070f14d60a3b73eb2aa8723cd25 100644 (file)
@@ -290,6 +290,7 @@ static void data_write(void)
 
 
 ff_vecs_t holux_vecs = {
+       ff_type_file,
        rd_init,
        wr_init,
        rd_deinit,
index 6c52443d615980bc1d11aa4c13ce1f275252bb29..2cc2ddee1075bba6bcc7967cecb8a22bf08e79e5 100644 (file)
@@ -65,6 +65,7 @@ static char custom[] =
 "FIELD_DELIMITER               COMMA\n"
 "RECORD_DELIMITER      NEWLINE\n"
 "BADCHARS              COMMA\n"
+"FORMAT_TYPE           INTERNAL\n"
 
 "#\n"
 "# HEADER STUFF:\n"
@@ -458,6 +459,7 @@ static char tabsep[] =
 "FIELD_DELIMITER               TAB\n"
 "RECORD_DELIMITER      NEWLINE\n"
 "BADCHARS              TAB\n"
+"FORMAT_TYPE           INTERNAL\n"
 
 "#\n"
 "# INDIVIDUAL DATA FIELDS:\n"
index a8449bb051258526db3a9edb15791c7e3691e422..e8483743704a0d13554f046604c420099f8dc56f 100644 (file)
@@ -262,6 +262,7 @@ data_write(void)
 
 
 ff_vecs_t magnav_vec = {
+       ff_type_file,
        rd_init,
        wr_init,
        rd_deinit,
index c0f09945265a7a6a17c4b9671669bdff238a62ef..79738bab9f501174a275bd4f3103aa4ca564f8ae 100644 (file)
@@ -1343,6 +1343,7 @@ mag_write(void)
 }
 
 ff_vecs_t mag_vecs = {
+       ff_type_serial,
        mag_rd_init,    
        mag_wr_init,    
        mag_deinit,     
index 6b6178c5f2ea0af44ad49aa595f43ced2faeb81f..ebc8bd83f7b2561ff857e89963a8cd84eaafe0b1 100644 (file)
@@ -310,6 +310,7 @@ data_write(void)
 
 
 ff_vecs_t mapopolis_vecs = {
+       ff_type_file,
        rd_init,
        wr_init,
        rd_deinit,
index 1feecd5e87b040d1b0cee1c6fd166b8401e162bb..449dc4f715d0e86c94e540dfbb5a22df2767a139 100644 (file)
@@ -583,6 +583,7 @@ mapsend_wpt_write(void)
 
 
 ff_vecs_t mapsend_vecs = {
+       ff_type_file,
        mapsend_rd_init,
        mapsend_wr_init,
        mapsend_rd_deinit,
index dbd9b3af3012eaaa1204efdf1ece97b61382b052..9cff4672b25f0039ccccc4a11c194ad7e31871f2 100644 (file)
@@ -1981,6 +1981,7 @@ mps_write(void)
 }
 
 ff_vecs_t mps_vecs = {
+       ff_type_file,
        mps_rd_init,
        mps_wr_init,
        mps_rd_deinit,
index 91a04b8f6915d6c453c7942bf2544136dcac8e49..e42bbb6e98ca1ad820c12f5d1a600ebe206e9e59 100644 (file)
@@ -205,6 +205,7 @@ nav_write(void)
 }
 
 ff_vecs_t navicache_vecs = {
+       ff_type_file,
        nav_rd_init,    
        nav_wr_init,    
        nav_rd_deinit,
index 38f96cca96fc2f8730460e2b9610ad7dd75fcd05..6bab42a96a4fa6af8f50076b467ff948f7eb75c6 100644 (file)
@@ -317,6 +317,7 @@ nmea_write()
 }
 
 ff_vecs_t nmea_vecs = {
+       ff_type_file,
        nmea_rd_init,   
        nmea_wr_init,   
        nmea_rd_deinit, 
index 7474520c6bd7f812f87bcbfc17919c6600276946..3de14fa1be425265e06cdbdad45fdaf00e177a0e 100644 (file)
@@ -691,6 +691,7 @@ data_write(void)
 }
 
 ff_vecs_t ozi_vecs = {
+    ff_type_file,
     rd_init,
     wr_init,
     rd_deinit,
index 3731c33b9b5ac7fd2f343239ecfb205f401582de..974c63bd4a70a0bc7aa43572d362f2cb83c36a6f 100644 (file)
@@ -166,6 +166,7 @@ fprintf(file_out,
 
 
 ff_vecs_t pcx_vecs = {
+       ff_type_file,
        rd_init,
        wr_init,
        rd_deinit,
index 7a848a8a03056dada20fceb74579b9d3c6313773..fe55b6c5ed297eee8b6e1d5291ffd9509dd04c77 100755 (executable)
@@ -797,6 +797,7 @@ psit_write(void)
 }
 
 ff_vecs_t psit_vecs = {
+       ff_type_file,
        psit_rd_init,
        psit_wr_init,
        psit_rd_deinit,
index ee009b62132b9601b5de5c8e84ff38a19e80bc65..01fde6645da8dad98034381123923ae2713e135e 100644 (file)
@@ -458,6 +458,7 @@ psp_write(void)
 }
 
 ff_vecs_t psp_vecs = {
+       ff_type_file,
        psp_rd_init,
        psp_wr_init,
        psp_rd_deinit,
index c49149b1e95d21e95277949017ef07fd32639168..bf8796d3da0ac5c5668cc81618ddef8c68c59179 100644 (file)
@@ -284,6 +284,7 @@ data_write(void)
 
 
 ff_vecs_t quovadis_vecs = {
+       ff_type_file,
        rd_init,
        wr_init,
        rd_deinit,
index a4725ef5482faf8ea5e97fcdb48f16c34dc0044c..d5cdfdbd6480939f0003d69a06117e0b8cda200e 100644 (file)
@@ -235,6 +235,7 @@ wr_init(const char *fname)
 }
 
 ff_vecs_t saroute_vecs = {
+       ff_type_file,
        rd_init,
        wr_init,
        rd_deinit,
index 1c871cb066270d7b5f57fcd016354cf55bb17523..d3776aaf19feb23787d0ba46c323611a1173738c 100644 (file)
@@ -13,6 +13,7 @@ DESCRIPTION           Custom "Everything" Style
 FIELD_DELIMITER                COMMA
 RECORD_DELIMITER       NEWLINE
 BADCHARS               COMMA
+FORMAT_TYPE            INTERNAL
 
 #
 # HEADER STUFF:
index 1f75d7ddc226eb749cc521ae67146405fe066e4e..af9efd4b48bf48180f959f4303f926be57797dda 100644 (file)
@@ -19,6 +19,7 @@ DESCRIPTION           All database fields on one tab-separated line
 FIELD_DELIMITER                TAB
 RECORD_DELIMITER       NEWLINE
 BADCHARS               TAB
+FORMAT_TYPE            INTERNAL
 
 #
 # INDIVIDUAL DATA FIELDS:
index 865b5d7a576bd0921cefb38240ffd5eb0ab3705d..312fa0e7def4571c84c22559066566d696e713c7 100644 (file)
@@ -272,6 +272,7 @@ data_write(void)
 
 
 ff_vecs_t tiger_vecs = {
+       ff_type_file, 
        rd_init,
        wr_init,
        rd_deinit,
index 875e009f3dfaf3228cee8daab610c85dc920bce4..e9968814d9539dd72ee9b7cd0f15561f033e1678 100644 (file)
@@ -243,6 +243,7 @@ data_write(void)
 }
 
 ff_vecs_t tmpro_vecs = {
+    ff_type_file,
     rd_init,
     wr_init,
     rd_deinit,
index 226ff7d03ee8d0ec485f3d359bebf2e0636251f5..f8766f4231f949e4d8f7f782fe2eecd349951350 100644 (file)
@@ -334,6 +334,7 @@ tpg_write(void)
 }
 
 ff_vecs_t tpg_vecs = {
+       ff_type_file,
        tpg_rd_init,
        tpg_wr_init,
        tpg_rd_deinit,
index 23258201efb0ed04d0e1f1852b65f3ec6a3a707e..de7a670af48ec02f9408af224d0fd43b33ee1e6c 100644 (file)
@@ -404,6 +404,22 @@ disp_vecs(void)
        }
 }
 
+/*
+ * Additional information for V1.
+ * Output format type at front of line.
+ */
+disp_v1(ff_type t)
+{
+       char *tstring;
+               
+       switch (t) {
+               case ff_type_file: tstring = "file"; break;
+               case ff_type_serial: tstring = "serial"; break;
+               case ff_type_internal: tstring = "internal"; break;
+               default: tstring = "unknown"; break;
+       }
+       printf("%s\t", tstring);
+}
 /*
  *  Display the available formats in a format that's easy to machine
  *  parse.   Typically invoked by programs like graphical wrappers to
@@ -417,13 +433,18 @@ disp_formats(int version)
 
        switch(version) {
        case 0:
+       case 1:
                for (vec = vec_list; vec->vec; vec++) {
+                       if (version > 0)
+                               disp_v1(vec->vec->type);
                        printf("%s\t%s\t%s\n", vec->name, 
                                vec->extension? vec->extension : "", 
                                vec->desc);
                }
                for (svec = style_list; svec->name; svec++) {
                        xcsv_read_internal_style(svec->style_buf);
+                       if (version > 0)
+                               disp_v1(xcsv_file.type);
                        printf("%s\t%s\t%s\n", svec->name, xcsv_file.extension ? 
                                xcsv_file.extension : "", xcsv_file.description);
                }
index 37a9f58e007806fae987f31342700adcf4edb680..116dd53a3420913e2ce5bac991cbf2ce3b9205d2 100644 (file)
@@ -251,6 +251,20 @@ xcsv_parse_style_line(const char *sbuff)
                
        } else
 
+       if (ISSTOKEN(sbuff, "FORMAT_TYPE")) {
+               const char *p;
+               for (p = &sbuff[11]; *p && isspace(*p); p++) {
+                       ;
+               }
+               if (ISSTOKEN(p, "INTERNAL")) {
+                       xcsv_file.type = ff_type_internal;
+               } 
+               /* this is almost inconcievable... */
+               if (ISSTOKEN(p, "SERIAL")) {
+                       xcsv_file.type = ff_type_serial;
+               } 
+       } else
+
        if (ISSTOKEN(sbuff, "DESCRIPTION")) {
                xcsv_file.description = csv_stringtrim(&sbuff[11],"", 0);
        } else
@@ -521,6 +535,7 @@ xcsv_wr_deinit(void)
 }
 
 ff_vecs_t xcsv_vecs = {
+    ff_type_internal,
     xcsv_rd_init,
     xcsv_wr_init,
     xcsv_rd_deinit,